package com.caishi.lkx.exam.api;

import com.caishi.lkx.common.AdminBaseApi;
import com.caishi.lkx.exam.service.IExColumnConfigReService;
import com.zzw.common.Wrappers;

import com.caishi.lkx.exam.model.re.ExColumnConfigReModel;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: Janisa
 * @date: 2022/3/17 18:40
 * @description:
 */

@Tag(name = "栏目配置相关接口")
@Slf4j
@RestController
@RequestMapping("/exam/config")
public class ExColumnConfigReApi extends AdminBaseApi<IExColumnConfigReService, ExColumnConfigReModel, Long> {

    @Resource
    private IExColumnConfigReService service;

    @Override
    public IExColumnConfigReService loadService() {
        return service;
    }

    @DeleteMapping("/delete-configId")
    public boolean deleteByConfigId(@RequestParam String columnId, @RequestParam String configId){
            return this.loadService().delete(Wrappers.<ExColumnConfigReModel>lambdaQuery().eq(ExColumnConfigReModel::getColumnId,columnId).eq(ExColumnConfigReModel::getConfigId,configId))>0;
    }
    @GetMapping("/configIds")
    public List<ExColumnConfigReModel> getConfigId(@RequestParam String id){
        return this.loadService().selectList(Wrappers.<ExColumnConfigReModel>lambdaQuery().eq(ExColumnConfigReModel::getColumnId,id));
    }
}
